import 'expert_live_info.dart';

class HotExpertEntity {
  double? hit;
  int? index;
  int? isFocus;
  int? isSale;
  int? profit;
  String? userId;
  String? logo;
  String? name;
  String? value;
  int? viewCnt;
  String? expertId;
  int? isInvite;
  ExpertLiveInfo? liveInfo;

  HotExpertEntity(
      {this.hit,
        this.index,
        this.isFocus,
        this.isSale,
        this.profit,
        this.userId,
        this.logo,
        this.name,
        this.value,
        this.viewCnt,
        this.expertId,
        this.isInvite,
        this.liveInfo
      });

  HotExpertEntity.fromJson(Map<String, dynamic> json) {
    hit = json['hit'];
    index = json['index'];
    isFocus = json['isFocus'];
    isSale = json['isSale'];
    profit = json['profit'];
    userId = json['userId'];
    logo = json['userLogo'];
    name = json['userName'];
    value = json['value'];
    viewCnt = json['cnt'];
    expertId = json['expertId'];
    isInvite = json['isInvite'];
    liveInfo = ExpertLiveInfo(
      liveId: json['liveId'],
      liveSportsId: json['liveSportsId'],
      matchId: json['matchId'],
      bindMatch: json['bindMatch']
    );
  }

  HotExpertEntity.fromJsonMatch(Map<String, dynamic> json) {
    hit = json['hit'];
    index = json['index'];
    isFocus = json['isFocus'];
    isSale = json['isSale'];
    profit = json['profit'];
    userId = json['userId'];
    logo = json['expertLogo'];
    name = json['expertName'];
    value = json['tag'];
    viewCnt = json['cnt'];
    expertId = json['expertId'];
    isInvite = json['isInvite'];
    liveInfo = ExpertLiveInfo(
        liveId: json['liveId'],
        liveSportsId: json['liveSportsId'],
        matchId: json['matchId'],
        bindMatch: json['bindMatch']
    );
  }

  HotExpertEntity.fromSeparateValue(Map<String, dynamic> json) {
    viewCnt = json['cnt'];
    expertId = json['expertId'];
    logo = json['expertLogo'];
    name = json['expertName'];
    isFocus = json['isFocus'];
    if(json['redKeepHigh'] != null){
      value = json['redKeepHigh'];
    }else if(json['mn'] != null){
      value = json['mn'];
    }else{
      value = "足球分析师";
    }
    isInvite = json['isInvite'];
    liveInfo = ExpertLiveInfo(
        liveId: json['liveId'],
        liveSportsId: json['liveSportsId'],
        matchId: json['matchId'],
        bindMatch: json['bindMatch']
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['hit'] = this.hit;
    data['index'] = this.index;
    data['isFocus'] = this.isFocus;
    data['isSale'] = this.isSale;
    data['profit'] = this.profit;
    data['userId'] = this.userId;
    data['userLogo'] = this.logo;
    data['userName'] = this.name;
    data['value'] = this.value;
    data['cnt'] = this.viewCnt;
    data['liveId'] = this.liveInfo?.liveId;
    data['liveSportsId'] = this.liveInfo?.liveSportsId;
    data['matchId'] = this.liveInfo?.matchId;
    data['bindMatch'] = this.liveInfo?.bindMatch;
    data['expertId'] = this.expertId;
    data['isInvite'] = this.isInvite;
    return data;
  }
}
